﻿@model SYJ.Model.Entities.SysRole
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title></title>
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.11.3.min.js"></script>
    <script src="~/Content/layui/layui.js"></script>
    <script src="~/Scripts/Common.js"></script>

</head>
<body class="layui-container">
    <div class="layui-row">
        <form class="layui-form" action="" id="form1" method="post">
            <input type="hidden" id="id" name="id" value="@Model.id" />
            <div class="layui-form-item">
                <label class="layui-form-label">角色名称</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入角色名称" autocomplete="off" value="@Model.title" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="text" name="seq" lay-verify="number" placeholder="请输入排序数字" autocomplete="off" value="@Model.seq" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色图标</label>
                <div class="layui-input-block">
                    <input type="text" name="iconCls" placeholder="请输入角色图标" autocomplete="off" value="@Model.iconCls" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">说明</label>
                <div class="layui-input-block">
                    <textarea name="description" placeholder="请输入说明内容" class="layui-textarea"> @Model.description </textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="form1" type="button">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    <script>
        layui.use(['form', 'jquery'], function () {
            var form = layui.form;
            var $ = layui.jquery;
            //监听提交
            form.on('submit(form1)', function (data) {
                $.ajax({
                    type: "POST",
                    url: '/admin/SysRoleMgr/AddOrUp',
                    data: data.field,
                    dataType: "json",
                    //traditional: true, //传数组进后台需要设置该属性
                    success: function (data) {
                        if (data) {
                            layer.msg("操作成功,2秒后自动关闭", function () {
                                parent.layui.table.reload('tid');
                                //当你在iframe页面关闭自身时
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            });
                        }
                        else {
                            layer.msg("操作失败");
                        }
                    }
                });
                return false;
            });

        });
    </script>

</body>



</html>